#!/bin/bash

tar -czf huaweicloud-sdk-java-src.tar.gz $(find . -maxdepth 1 -mindepth 1  | egrep -v ".cid|.git|.codecheck|buildscript|*.sh")

mvn clean package -q -T 4 || exit 2
find . -type f -name "*.jar" -exec cp -f {} . \;
tar -czf huaweicloud-sdk-java-bin.tar.gz ./*.jar

version_suffix="$(awk '/<version>[^<]+<\/version>/{gsub(/<version>|<\/version>/,"",$1);print $1;exit;}' ./pom.xml).${CID_BUILD_TIME}.${CID_BUILD_NUMBER}"
tar -czf huaweicloud-sdk-java-release."${version_suffix}".tar.gz huaweicloud-sdk-java-src.tar.gz huaweicloud-sdk-java-bin.tar.gz
